home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 2 / MacMania 2.toast / Demo's / Tools&Utilities / Business⁄work / The Akston Engine / Time < prev   
Encoding:
Text File  |  1994-06-11  |  1.7 KB  |  75 lines  |  [TEXT/HAks]

  1.  
  2.  
  3.                    Time Sheet Calculator
  4.  
  5. PURPOSE: To calculate hours worked.
  6.  
  7. DESCRIPTION: Time values are expressed as Hours.Minutes.
  8.  
  9.              Results are in terms of decimal hour units.
  10.  
  11. USAGE:  h( <TimeClockedIn>, <TimeClockedOut> ) 
  12.  
  13.           eg.   h( 8.00, 12.00 ) = 4.0 
  14.                 h( 9.00,  1.00 ) = 4.0 
  15.  
  16. ASSUMES: No more than twelve hours are worked at a stretch.
  17.  
  18.  
  19. EXAMPLE: Edit the clock-in/clock-out times below and press 
  20.          the 'Enter' key or 'Shift-Return' to produce the  
  21.          new total.
  22.  
  23.     Mon = h( 9.15,  1.45 ) + h( 2.30, 5.30 )
  24.  
  25.     Tue = h( 8.30, 12.00 ) + h( 1.12, 5.00 )
  26.  
  27.     Wed = h( 8.24, 11.12 ) + h( 1.22, 4.30 )
  28.  
  29.     Thr = h( 8.05, 12.02 ) + h( 1.23, 4.45 )
  30.  
  31.     Fri = h( 8.13, 12.14 ) + h( 1.09, 4.00 )
  32.  
  33.     TotalForWeek = Mon + Tue + Wed + Thr + Fri
  34.  
  35.  
  36.     TotalForWeek =  
  37.  
  38. ==============================================================
  39.  
  40. FUNCTION DEFINITIONS:
  41.  
  42. These are the building-block functions used:
  43.  
  44.         Get the fractional part of a number:
  45.  
  46.     FractionPart(x) = x - int(x)
  47.  
  48.         Get the number of minutes packed in an hour.minutes 
  49.         format number:
  50.  
  51.     MinutePart(h.m) = FractionPart(h.m) * 100
  52.  
  53.         Get the number of hours packed in an hour.minutes 
  54.         format number:
  55.  
  56.     HourPart(h.m) = int(h.m)
  57.  
  58.         Convert times in hours.minutes format to decimal
  59.         hour format:
  60.  
  61.     h.mTOh.h( h.m ) = HourPart(h.m) + MinutePart(h.m) / 60
  62.  
  63.         Calculate a new clock-out time that it is 
  64.         numerically larger than the clock-in time.  A noon 
  65.         or midnight adjustment.
  66.     
  67.     NewOut( In, Out ) = h.mTOh.h( if( Out < In, Out+12, Out ) )
  68.  
  69. This is the main function that computes hours worked:
  70.  
  71.     h( In, Out ) = fix( 1, NewOut( In, Out ) - h.mTOh.h(In) )
  72.  
  73.  
  74.  
  75.